package com.mall.service;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mall.entity.Order;
import com.mall.entity.OrderItem;

import java.util.List;

/**
 * @author ShouPeng
 * @since 2024-01-17
 */
public interface IOrderService {

    /**
     * 查询订单
     * @param page 页
     * @return list
     */
    IPage<Order> queryOrder(Page<Order> page, String userId);


    /**
     * 用户查询订单
     * @return list
     */
    Order queryOrderById(String userId,String orderId);


    /**
     * 删除订单
     * @param ids ids
     * @return success count
     */
    void deleteOrder(List<String> ids);

    /**
     * 删除订单
     * @param ids ids
     * @return success count
     */
    void deleteOrder(List<String> ids,String userId);

    /**
     * 修改订单
     * @param order entity
     * @return bool
     */
    Boolean updateOrder(Order order);

    /**
     * 添加订单
     * @param order entity
     * @return bool
     */
    Boolean addOrder(Order order, List<OrderItem> items) throws Exception;

    /**
     * 设置订单状态
     * @param orderId 订单id
     * @param userId 用户id
     * @param status 订单状态 0-取消 1-下单 2-支付完成 3-配货 4-出库 5-完成订单
     * @return bool
     */
    Boolean setOrderStatus(String orderId,String userId,Integer status,Integer payType);

    /**
     * 根据订单号查询订单
     * @param orderNo
     * @return
     */
    Order selectByOrderNo(String orderNo);
}
